<?php
	// Settings for slideshow loop

	global $post;
	global $sl_settings;
	
	$i = 1;	
	$slideshow = $sl_settings['specific_slideshow'];
	$loop = new WP_Query( array(	
		'post_type'      => 'slide',
		'slideshow'      => $slideshow,
		'posts_per_page' => $sl_settings['slide_quantity']
		
	) ); ?>
	
	<div id="cv-slideshow" class="cv-slides <?php	
			// Adds classes to slideshow	
			echo $slideshow . ' ';	
				
			echo $metadata;			
		?>">			
			
		<ol>
			<?php // Loop which loads the slideshow
			while ( $loop->have_posts() ) : $loop->the_post(); ?>

				<li>		
					<h2><span><?php the_title(); ?></span></h2>
					<div>
					<?php // Adds slide image with Slide URL link						
					if ( get_post_meta( $post->ID, "slide_url_value", $single = true ) != "" ): ?>							
						<a href="<?php echo get_post_meta( $post->ID, "slide_url_value", $single = true ); ?>" title="<?php the_title(); ?>">
							<?php if ( current_theme_supports( 'get-the-image' ) ) {
								$thumb = get_the_image( array( 'format' => 'array', 'echo' => false, 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'default_size' => 'featured-slide' ) );  ?>								
								<img title="<?php the_title(); ?>" src="<?php echo $thumb['src'];?>">
							<?php }	?>						
						</a>
					<?php // Adds slide image without Slide URL link						
					else: ?>						
						<?php if ( current_theme_supports( 'get-the-image' ) ) {
								$thumb = get_the_image( array( 'format' => 'array', 'echo' => false, 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'default_size' => 'featured-slide' ) );  ?>								
								<img src="<?php echo $thumb['src'];?>">
						<?php }	?>					
					<?php endif; ?>	
					</div>
				</li><!-- ol -->		
				
			<?php endwhile; ?>					
			<?php wp_reset_query(); ?>
		</ol>
				
		</div><!-- .cv-slides -->	
	